// // 两数和（leetCode第一题），一次for循环解决
// 解题思路，使用hash解题
// const twoSum = function(nums, target) {
//   let i = 0
//   let obj = {}
//   let result = []
//   for (i; i < nums.length; i++) {
//     let b = target - nums[i]
//     if (typeof(obj[nums[i]]) !== 'undefined') {
//       result.push(obj[nums[i]])
//       result.push(i)
//       return result
//     }
//     obj[b] = i
//   }
// };

// let result = twoSum([2,11,7,15], 9)
// console.log(result, 'result');

var addTwoNumbers = function(l1, l2) {
  let i = 0
  let j = 0
  let k = 0
  let l1Add = 0
  let l2Add = 0
  let result = 0
  let resultList = []
  for (i; i < l1.lenght; i++) {
      l1Add = l1Add + l1[i] * Math.pow(10, i)
  }
  for (j; j < l2.lenght; j++) {
      l2Add = l2Add + l1[j] * Math.pow(10, j)
  }
  result = l1Add + l2Add
  for (; true ; ) {
      if (k === 0) {
        resultList.push(result % 10)
      } else {
        if (parseInt(result / Math.pow(10, k)) === 0) {
          return resultList
        }
        resultList.push(parseInt(result / Math.pow(10, k)))
      }
      k++
  }
};

let a = addTwoNumbers([1, 2, 3], [1, 2, 3])
console.log(a, 'a');